package model;

import java.time.LocalDateTime;
import java.util.List;

public class Order {
    private String orderId; //订单id
    private List<Item>  items;//商品列表
    private OrderStatus status; //订单状态
    private double totalPrice;//总价
    private LocalDateTime createTime;//订单创建的时间戳

    private String remark; // 新增备注字段



    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Order(String orderId, List<Item> items, OrderStatus status, double totalPrice, LocalDateTime createTime, String remark) {
        this.orderId = orderId;
        this.items = items;
        this.status = status;
        this.totalPrice = totalPrice;
        this.createTime = createTime;
        this.remark = remark;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public List<Item> getItems() {
        return items;
    }

    public void setItems(List<Item> items) {
        this.items = items;
    }

    public OrderStatus getStatus() {
        return status;
    }

    public void setStatus(OrderStatus status) {
        this.status = status;
    }

    public double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Order{" +
                "\n  orderId='" + orderId + '\'' +
                ",\n  items=" + items +
                ",\n  status=" + status +
                ",\n  totalPrice=" + totalPrice +
                ",\n  createTime=" + createTime +
                ",\n  remark='" + remark + '\'' +
                "\n}";
    }

    // 订单状态枚举
    public enum OrderStatus {

        CREATED, // 订单已创建
        PAID,    // 订单已支付
        CANCELLED// 订单已取消
    }
}
